home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr23 / chansw53.zip / CHAINSAW.TUT < prev    next >
Text File  |  1993-05-24  |  16KB  |  464 lines

  1.  
  2.  
  3.  
  4.           
  5.           
  6.           
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.                                     CHAINSAW
  31.  
  32.                             Tutorial and Examples
  33.  
  34.                             Copyright 1992, Ted Davis
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.           
  62.           
  63.           
  64.           
  65.  
  66.  
  67.  
  68.  
  69.  
  70.                                                      CHAINSAW TUTORIAL
  71.           
  72.           
  73.           This tutorial will take you through most of the modes and 
  74.           some of the message patterns, one or two steps at a time.  
  75.           It will also provide examples of both command line and batch 
  76.           file operation. 
  77.  
  78.                  For learning purposes, we will use a floppy disk.  
  79.           The lessons assume drive 'A:', if you are using another 
  80.           drive, just replace the 'A:' or 'a:' part of the path with 
  81.           the drive you are using.  This tutorial assumes that you 
  82.           have read the manual, or at least scanned it and found the 
  83.           default password.  If you don't know the password, you can't 
  84.           make the program work.  CHAINSAW must not be on the scratch 
  85.           disk, it must be on a different drive, we will assume 'C:'. 
  86.  
  87.                  First we will see what happens if you don't get the 
  88.           command tail right:
  89.           Change the default drive and directory to the one that has 
  90.           CHAINSAW in it or make sure CHAINSAW is in the path;
  91.           invoke CHAINSAW with no command tail -
  92.  
  93.                  CHAINSAW <Enter>
  94.  
  95.           which should get you the barf message.
  96.  
  97.           Now we will try something more useful, cleaning out a \temp 
  98.           directory:
  99.           Prepare a scratch disk by inserting a 
  100.           blank, formatted diskette in the drive you wish to use and 
  101.           invoking the MKSCRTCH batch file - 
  102.  
  103.                  MKSCRTCH A 1 <Enter> 
  104.  
  105.           for the 'A:' drive (or B, or C, or D, etc.).
  106.  
  107.                  The batch file will create a directory tree and copy 
  108.           itself to each directory (with several different names). Use 
  109.           DIR, DOSSHELL, or some other utility to look at the scratch 
  110.           disk - you should find 25 files in the root and three 
  111.           subdirectories and sub-sub (etc.) directories.
  112.                  Now for the test - invoke CHAINSAW with its default 
  113.           switches and a:\temp as the target directory with this 
  114.           command line, replacing {password} with the default password 
  115.           given in the manual. 
  116.  
  117.                  CHAINSAW a:\temp {password} <Enter>
  118.  
  119.           You should have gotten this response:
  120.  
  121.  
  122.  
  123.                  Now take a look at the directory structure - there 
  124.           should be nothing left except the root and its files, \foo 
  125.           and its files, and \temp and its files.
  126.  
  127.           
  128.           
  129.           
  130.                                         1
  131.  
  132.  
  133.  
  134.  
  135.  
  136.                                                      CHAINSAW TUTORIAL
  137.           
  138.           
  139.                  But maybe you want the \temp directory completely 
  140.           empty, instead of just devoid of subdirectories.  Rebuild 
  141.           the scratch disk with the same MKSCRTCH command and try this
  142.  
  143.                  CHAINSAW a:\temp {password} /f <Enter>
  144.  
  145.           (making sure that the 'f' is lower case).
  146.  
  147.                  The summary should show five more files deleted.  Now 
  148.           look at the \temp directory and note that it is completely 
  149.           empty of both files and subdirectories.  Note also that the 
  150.           root and \foo directories are completely untouched.
  151.  
  152.                  For even more through cleaning, try
  153.  
  154.                  CHAINSAW a:\temp {password} /g <Enter>
  155.  
  156.           and note that now the entire \temp directory is gone.  You 
  157.           could try that again after running MKSCRTCH again but the 
  158.           effect is the same.  Note also the above 'g' switch must 
  159.           be lower case.
  160.  
  161.                  Now lets add some list messages.  To save time, we 
  162.           will combine that with the /r switch.  Without rebuilding 
  163.           the scratch disk (it still has ten files in two 
  164.           directories), we invoke the program this way -
  165.  
  166.                  CHAINSAW a:\ {password} /frdl <Enter>
  167.  
  168.           which enables file removal from the given directory, 
  169.           operation in the root directory, and listing of both file 
  170.           and directory deletions.  Note that all switches are lower 
  171.           case.
  172.  
  173.                  DIR a: now shows that only the volume label is left 
  174.           on the disk.
  175.  
  176.                  It isn't always that easy; sometimes there are 
  177.           hidden, read-only, or system files to be removed.  Invoke 
  178.           MKSCRTCH again to rebuild the scratch disk, this time with 
  179.           some of the files protected -
  180.  
  181.                  MKSCRTCH A 2 <Enter>
  182.  
  183.           which marks one file in each directory read-only, one 
  184.           hidden, and one both hidden and read-only.
  185.  
  186.                  Repeat the last invocation of CHAINSAW (/frdl) only 
  187.           this time, redirect the output to a file.  For the example 
  188.           we will assume that the destination file is 
  189.           c:\temp\chainsaw.lst.  The command line is -
  190.  
  191.           CHAINSAW a:\ {password} /f r,d;l > c:\temp\chainsaw.lst <Enter>
  192.  
  193.           
  194.           
  195.           
  196.                                         2
  197.  
  198.  
  199.  
  200.  
  201.  
  202.                                                      CHAINSAW TUTORIAL
  203.           
  204.           
  205.           which also illustrates alternate ways of entering the 
  206.           switches.  Now use your word processor or editor to look at 
  207.           the list file and also look at the disk.  You should note 
  208.           that the directory structure is still intact and that each 
  209.           directory shows one file (the read-only one) but that the 
  210.           total files line in the DIR response includes two more that 
  211.           don't show.  The list file contains a lot of failure 
  212.           messages: one for each protected file and one for each sub 
  213.           directory.  Lets get rid of the leftovers and wipe the disk 
  214.           clean. 
  215.  
  216.                  CHAINSAW a:\ {password} /frdlp <Enter>
  217.  
  218.                  Note that the program now leaves the disk blank, 
  219.           except for the volume label, and the list now shows the 
  220.           protected files and all subdirectories as successfully 
  221.           removed.   The unprotected files were removed on the 
  222.           previous pass.
  223.  
  224.                  Since it isn't feasible to demonstrate the network 
  225.           drive protection switch on a floppy, we will just skip it.  
  226.           If you have a network, you could set up a dummy directory 
  227.           and files and use the /n switch to enable their removal.  
  228.           Just be careful to specify the dummy directory as the base 
  229.           and use the /f or /g switches.
  230.  
  231.                  So much for the mode control switches, now lets try a 
  232.           few variations of the message control switches.  Let's also 
  233.           play around with using CHAINSAW from a batch file.   The 
  234.           file CHTST.BAT contains the call to CHAINSAW, less the 
  235.           password.  It also invokes MKSCRTCH for drive A:.  If you 
  236.           are using some other drive for the scratch disk, use a text 
  237.           editor to change 'A:' in the CHAINSAW command tail and 
  238.           the 'A' in the MKSCRTCH call to whatever drive you are 
  239.           using.  Also change the c:\temp\chainsaw.lst redirection to 
  240.           whatever you want.  The modified file must be in ASCII format.
  241.           In any case, examine the batch file to see what the command 
  242.           tails are for the various modes.  The batch file uses the 
  243.           DOS batch file CALL command.  If your version of DOS does 
  244.           not support it, change CALL to COMMAND /C
  245.  
  246.                  CHTST 1 {password} <Enter>
  247.  
  248.           displays the copyright and summary on the screen and sends 
  249.           the list of deleted files to c:\temp\chainsaw.lst.  It uses 
  250.           the switch string /freDL, 'fr' to enable removing files from 
  251.           the root, 'e' to send everything to STDERR (the screen), and 
  252.           'DL' to enable listing and send the lists to STDOUT 
  253.           (redirected to c:\temp\chainsaw.lst).  This shows that later 
  254.           switches ('D' and 'L') can override earlier ones ('e').
  255.  
  256.                  CHTST 2 {password} <Enter> shows what happens if 
  257.           there are removal errors: the list of removals still goes to 
  258.           the file, but the list of failures goes to the screen.
  259.           
  260.           
  261.           
  262.                                         3
  263.  
  264.  
  265.  
  266.  
  267.  
  268.                                                      CHAINSAW TUTORIAL
  269.           
  270.           
  271.                  CHTST 3 {password} <Enter> uses a variation of the 
  272.           'e' switch ('eo') to send the failure messages to the file 
  273.           also.  Here is a bit of a trick that you can use to get the 
  274.           successes and failures in separate files.  The 'E' switch 
  275.           could be used instead of 'eo' but would send the copyright 
  276.           and summary messages to the file also.  Ignore the DOS error 
  277.           messages: DOS is trying to copy over read-only files and 
  278.           reset the attributes of hidden files left over from CHTST 2. 
  279.  
  280.                  FIND "***" c:\temp\chainsaw.lst > a:\bad.lst <Enter>
  281.                  FIND "..." c:\temp\chainsaw.lst > a:\ok.lst <Enter>
  282.  
  283.           will create two files on the scratch disk with the list of 
  284.           deletions in ok.lst and the list of failures in bad.lst.
  285.  
  286.                  Let's get fancy.  If you do not have a copy of some 
  287.           version of AWK that accepts standard AWK scripts, you will 
  288.           need to get one to complete this example.  I recommend GAWK, 
  289.           which is freeware from the Free Software Foundation.  There 
  290.           are several AWK scripts in the CHAINSAW package.  We will 
  291.           use SPLITLST.AWK to send the success and failure lists to 
  292.           separate files.  The script creates its destination files in 
  293.           the default directory unless you tell it otherwise.  For the 
  294.           example, we will accept all its defaults.
  295.  
  296.                  Rebuild the scratch disk with -
  297.  
  298.                  MKSCRTCH A 2 <Enter>
  299.  
  300.                  Then -
  301.  
  302.           CHAINSAW a:\ {password} /frEDL | AWK -f splitlst.awk <Enter>  
  303.  
  304.           creates the two files DONE.LOG and FAIL.LOG for the success 
  305.           and failure messages respectively.  You could also use
  306.           /frb | AWK -f splitlst.awk > other.log to create three 
  307.           files: one for success messages, one for failure messages, 
  308.           and one (OTHER.LOG) for all the other messages.  The 'b' 
  309.           switch sends all messages to STDOUT, and AWK then splits 
  310.           STDOUT into three streams, two to named files and the 
  311.           residue back to STDOUT for further processing or 
  312.           redirection.
  313.  
  314.                  If you don't know about AWK, you should.  It is one 
  315.           of the most difficult, but also most useful, utilities to 
  316.           be had anywhere, at any price.  Some versions are even free.  
  317.           The example script only hints at its power.
  318.  
  319.  
  320.                  By now, you should have a fair idea of what CHAINSAW 
  321.           is and what it can do.  Let's move on to setting up your own 
  322.           custom version.  You will certainly want to change the 
  323.           password, or even eliminate it and in all likelihood, you 
  324.           will want the default switches to be somewhat different.
  325.           
  326.           
  327.           
  328.                                         4
  329.  
  330.  
  331.  
  332.  
  333.  
  334.                                                      CHAINSAW TUTORIAL
  335.           
  336.           
  337.                  First, we will remove the password, then install a 
  338.           new one.
  339.  
  340.                  CHAINSAW /Z {password} <Enter>
  341.  
  342.           removes the default password.  The program is now as open as 
  343.           FORMAT to use by any fool who comes along and wants to play 
  344.           games with your machine.  It is also somewhat easier for you 
  345.           to use.  The choice is yours.
  346.  
  347.                  We do not have to remove the password to install 
  348.           another, that just showed how to do it.  Now install a 
  349.           temporary password for practice.  Use "White.Rabbit".
  350.  
  351.                  CHAINSAW \zWhite.Rabbit <Enter>
  352.  
  353.                  Call CHAINSAW to test it -
  354.  
  355.                  CHAINSAW a:\ White.Rabbit -fr <Enter>
  356.  
  357.                  Note that either '/' or '-' is acceptable for the 
  358.           switch marker.
  359.  
  360.                  You should get a report that the program did nothing.
  361.                  You should not get the bad password message.
  362.  
  363.                  Now try introducing an error, omitting the period -
  364.  
  365.                  CHAINSAW a:\ WhiteRabbit -fr <Enter>
  366.  
  367.                  You should have gotten the bad password message.
  368.  
  369.                  Now select a personal password, up to 15 characters, 
  370.           not including  <, >, |, space, or tab, unless within a 
  371.           quoted string.  Write it down and put it somewhere safe.  
  372.           Now install it -
  373.  
  374.                  CHAINSAW /z{new password} White.Rabbit <Enter>
  375.  
  376.           and repeat the above tests to be sure it works correctly.  
  377.           If you make a mistake that you cannot remedy, unzip another 
  378.           copy of CHAINSAW.EXE from the distribution package and start 
  379.           over.
  380.  
  381.                  Last, but not least, we practice changing default 
  382.           switches.  The program comes configured for safety rather 
  383.           than convenience.  For practice, lets make the defaults 
  384.           /BGNprfSW instead of /BGNPRsw -
  385.  
  386.                  CHAINSAW /a/BGNprfSW {password} <Enter>
  387.  
  388.                  Now
  389.  
  390.                  MKSCRTCH A 2 <Enter>
  391.           
  392.           
  393.           
  394.                                         5
  395.  
  396.  
  397.  
  398.  
  399.  
  400.                                                      CHAINSAW TUTORIAL
  401.           
  402.           
  403.                  CHAINSAW a:\ {password} <Enter>
  404.  
  405.           and experience a moment of panic - no messages at all, but 
  406.           the scratch disk is cleaned off completely.
  407.  
  408.                  MKSCRTCH A 2 <Enter>
  409.                  CHAINSAW a:\ {password} /w <Enter>
  410.  
  411.           brings back the messages by overriding the default 'W' with 
  412.           the given 'w' switch.
  413.  
  414.                  Restore the defaults -
  415.  
  416.                  CHAINSAW /A {password} <Enter>
  417.  
  418.                  You may eventually want to set up several versions of 
  419.           the program with different defaults.  That works fine.  You 
  420.           can rename the program and have several versions with 
  421.           different names in the same directory with no problems or 
  422.           interference; each version knows its own name.  You can also 
  423.           have different versions with the same name in separate 
  424.           directories; the program also knows where the copy in use 
  425.           lives, as well as its name.
  426.  
  427.                  Thus ends the tutorial; I hope it was enough to get 
  428.           you started and to show the most important aspects of the 
  429.           program.
  430.  
  431.           T.E.D. 1/12/92
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.           
  458.           
  459.           
  460.                                         6
  461.  
  462.  
  463.  
  464.